﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace WindowsFormsApplication4
{
    public partial class FormMainLPS : Form
    {

        private SqlConnection con = new SqlConnection();
       // private DataTable dt = new DataTable("tblCustomer");
        private SqlDataAdapter da = new SqlDataAdapter();
        public string txtnguoidung { set; get; }
        public string txtquyen { set; get; }
        private void connect()
        {
            string cn = "Data Source=(local);Initial Catalog=LoanPS;Integrated Security=True";
            try
            {
                con = new SqlConnection(cn);
                con.Open();//mo ket noi

            }
            catch (Exception ex)
            {
                MessageBox.Show("Khong ket noi duoc co so du lieu", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void disconnect()
        {
            con.Close();//dong ket noi
            con.Dispose();//giai phong tai nguyen
            con = null;//huy doi tuong

        }

        public FormMainLPS()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            connect();
            textBox1.Text = txtnguoidung.ToString();
            textBox2.Text = txtquyen.ToString();
        }

        private void button1_Click(object sender, EventArgs e)
        {
           

            }

        private void pictureBox1_Click(object sender, EventArgs e)
        {

        }

        private void pictureBox2_Click(object sender, EventArgs e)
        {
            DialogResult d=  MessageBox.Show("ban chac chan muon thoat chung trinh chu ", "thong bao", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
            if (d == DialogResult.OK)
                Application.Exit();
          
        }

        private void pictureBox4_Click(object sender, EventArgs e)
        {
            NhanVien NV = new NhanVien();
            NV.Show();
        }

        private void label4_Click(object sender, EventArgs e)
        {

        }

        private void pictureBox5_Click(object sender, EventArgs e)
        {
            DoiTac DT = new DoiTac();
            DT.Show();
        }

        private void pictureBox6_Click(object sender, EventArgs e)
        {
            KheUoc ku = new KheUoc();
            ku.Show();
        }

        private void pictureBox8_Click(object sender, EventArgs e)
        {
            HoaHong hh = new HoaHong();
            hh.Show();
            this.Close();
        }

        private void pictureBox12_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("ban co muon thay doi nguoi dung", "thong bao", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
            if (dr == DialogResult.OK)
            {
                FormDangNhap dn = new FormDangNhap();
                dn.Show();
               
            }
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
           

        }
        }

        
    }

